import javax.swing.JPanel;
import java.awt.GridBagLayout;
import javax.swing.JButton;
import java.awt.GridBagConstraints;
import javax.swing.JLabel;
import java.awt.Insets;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import javax.swing.JComboBox;
import java.awt.Font;


public class blendPanel extends JPanel {
	private JTextField blendID_textField;
	private JTextField blendType_textField;
	private JTextField blendName_textField;
	private JTextField blendDate_textField;
	private JTextField blendCost_textField;
	private JTextPane Comments_textPane;
	@SuppressWarnings("rawtypes")
	private JComboBox smellTest_comboBox;
	@SuppressWarnings("rawtypes")
	private JComboBox colorTest_comboBox;
	String[] boxStrings = { "1", "2", "3", "4"};

	/**
	 * Create the panel.
	 */
	public blendPanel() {
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWidths = new int[]{30, 73, 226, 0, 0, 122, 0};
		gridBagLayout.rowHeights = new int[]{25, 35, 22, 16, 16, 16, 16, 16, 16, 16, 0, 0};
		gridBagLayout.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, Double.MIN_VALUE};
		setLayout(gridBagLayout);

		JButton button = new JButton("<-Back");
		GridBagConstraints gbc_button = new GridBagConstraints();
		gbc_button.insets = new Insets(0, 0, 5, 5);
		gbc_button.gridx = 1;
		gbc_button.gridy = 0;
		add(button, gbc_button);

		JLabel lblEditValues = new JLabel("Edit Values");
		lblEditValues.setFont(new Font("Lao UI", Font.BOLD, 23));
		GridBagConstraints gbc_lblEditValues = new GridBagConstraints();
		gbc_lblEditValues.insets = new Insets(0, 0, 5, 5);
		gbc_lblEditValues.gridx = 2;
		gbc_lblEditValues.gridy = 0;
		add(lblEditValues, gbc_lblEditValues);

		JLabel lblBlendid = new JLabel("blendID");
		GridBagConstraints gbc_lblBlendid = new GridBagConstraints();
		gbc_lblBlendid.anchor = GridBagConstraints.EAST;
		gbc_lblBlendid.insets = new Insets(0, 0, 5, 5);
		gbc_lblBlendid.gridx = 1;
		gbc_lblBlendid.gridy = 2;
		add(lblBlendid, gbc_lblBlendid);

		blendID_textField = new JTextField();
		GridBagConstraints gbc_blendID_textField = new GridBagConstraints();
		gbc_blendID_textField.fill = GridBagConstraints.HORIZONTAL;
		gbc_blendID_textField.insets = new Insets(0, 0, 5, 5);
		gbc_blendID_textField.gridx = 2;
		gbc_blendID_textField.gridy = 2;
		add(blendID_textField, gbc_blendID_textField);
		blendID_textField.setColumns(10);

		JButton btnFindBlendComponents = new JButton("Find blend components");
		GridBagConstraints gbc_btnFindBlendComponents = new GridBagConstraints();
		gbc_btnFindBlendComponents.insets = new Insets(0, 0, 5, 0);
		gbc_btnFindBlendComponents.gridx = 5;
		gbc_btnFindBlendComponents.gridy = 2;
		add(btnFindBlendComponents, gbc_btnFindBlendComponents);

		JLabel lblBlendtype = new JLabel("blendType");
		GridBagConstraints gbc_lblBlendtype = new GridBagConstraints();
		gbc_lblBlendtype.anchor = GridBagConstraints.EAST;
		gbc_lblBlendtype.insets = new Insets(0, 0, 5, 5);
		gbc_lblBlendtype.gridx = 1;
		gbc_lblBlendtype.gridy = 3;
		add(lblBlendtype, gbc_lblBlendtype);

		blendType_textField = new JTextField();
		GridBagConstraints gbc_blendType_textField = new GridBagConstraints();
		gbc_blendType_textField.insets = new Insets(0, 0, 5, 5);
		gbc_blendType_textField.fill = GridBagConstraints.HORIZONTAL;
		gbc_blendType_textField.gridx = 2;
		gbc_blendType_textField.gridy = 3;
		add(blendType_textField, gbc_blendType_textField);
		blendType_textField.setColumns(10);

		JButton btnDisplayCurrentStock = new JButton("Display current stock");
		GridBagConstraints gbc_btnDisplayCurrentStock = new GridBagConstraints();
		gbc_btnDisplayCurrentStock.insets = new Insets(0, 0, 5, 0);
		gbc_btnDisplayCurrentStock.gridx = 5;
		gbc_btnDisplayCurrentStock.gridy = 3;
		add(btnDisplayCurrentStock, gbc_btnDisplayCurrentStock);

		JLabel lblBlendname = new JLabel("blendName");
		GridBagConstraints gbc_lblBlendname = new GridBagConstraints();
		gbc_lblBlendname.anchor = GridBagConstraints.EAST;
		gbc_lblBlendname.insets = new Insets(0, 0, 5, 5);
		gbc_lblBlendname.gridx = 1;
		gbc_lblBlendname.gridy = 4;
		add(lblBlendname, gbc_lblBlendname);

		blendName_textField = new JTextField();
		GridBagConstraints gbc_blendName_textField = new GridBagConstraints();
		gbc_blendName_textField.insets = new Insets(0, 0, 5, 5);
		gbc_blendName_textField.fill = GridBagConstraints.HORIZONTAL;
		gbc_blendName_textField.gridx = 2;
		gbc_blendName_textField.gridy = 4;
		add(blendName_textField, gbc_blendName_textField);
		blendName_textField.setColumns(10);

		JButton btnCompareComponentsSmelltests = new JButton("Compare components smellTests");
		GridBagConstraints gbc_btnCompareComponentsSmelltests = new GridBagConstraints();
		gbc_btnCompareComponentsSmelltests.insets = new Insets(0, 0, 5, 0);
		gbc_btnCompareComponentsSmelltests.gridx = 5;
		gbc_btnCompareComponentsSmelltests.gridy = 4;
		add(btnCompareComponentsSmelltests, gbc_btnCompareComponentsSmelltests);

		JLabel lblBlenddate = new JLabel("blendDate");
		GridBagConstraints gbc_lblBlenddate = new GridBagConstraints();
		gbc_lblBlenddate.anchor = GridBagConstraints.EAST;
		gbc_lblBlenddate.insets = new Insets(0, 0, 5, 5);
		gbc_lblBlenddate.gridx = 1;
		gbc_lblBlenddate.gridy = 5;
		add(lblBlenddate, gbc_lblBlenddate);

		blendDate_textField = new JTextField();
		GridBagConstraints gbc_blendDate_textField = new GridBagConstraints();
		gbc_blendDate_textField.insets = new Insets(0, 0, 5, 5);
		gbc_blendDate_textField.fill = GridBagConstraints.HORIZONTAL;
		gbc_blendDate_textField.gridx = 2;
		gbc_blendDate_textField.gridy = 5;
		add(blendDate_textField, gbc_blendDate_textField);
		blendDate_textField.setColumns(10);

		JLabel lblColortest = new JLabel("colorTest");
		GridBagConstraints gbc_lblColortest = new GridBagConstraints();
		gbc_lblColortest.anchor = GridBagConstraints.EAST;
		gbc_lblColortest.insets = new Insets(0, 0, 5, 5);
		gbc_lblColortest.gridx = 1;
		gbc_lblColortest.gridy = 6;
		add(lblColortest, gbc_lblColortest);

		colorTest_comboBox = new JComboBox(boxStrings);
		GridBagConstraints gbc_colorTest_comboBox = new GridBagConstraints();
		gbc_colorTest_comboBox.insets = new Insets(0, 0, 5, 5);
		gbc_colorTest_comboBox.fill = GridBagConstraints.HORIZONTAL;
		gbc_colorTest_comboBox.gridx = 2;
		gbc_colorTest_comboBox.gridy = 6;
		add(colorTest_comboBox, gbc_colorTest_comboBox);

		JLabel lblSmelltest = new JLabel("smellTest");
		GridBagConstraints gbc_lblSmelltest = new GridBagConstraints();
		gbc_lblSmelltest.anchor = GridBagConstraints.EAST;
		gbc_lblSmelltest.insets = new Insets(0, 0, 5, 5);
		gbc_lblSmelltest.gridx = 1;
		gbc_lblSmelltest.gridy = 7;
		add(lblSmelltest, gbc_lblSmelltest);

		smellTest_comboBox = new JComboBox(boxStrings);
		GridBagConstraints gbc_smellTest_comboBox = new GridBagConstraints();
		gbc_smellTest_comboBox.insets = new Insets(0, 0, 5, 5);
		gbc_smellTest_comboBox.fill = GridBagConstraints.HORIZONTAL;
		gbc_smellTest_comboBox.gridx = 2;
		gbc_smellTest_comboBox.gridy = 7;
		add(smellTest_comboBox, gbc_smellTest_comboBox);
		
		JLabel lblBlendcost = new JLabel("blendCost");
		GridBagConstraints gbc_lblBlendcost = new GridBagConstraints();
		gbc_lblBlendcost.anchor = GridBagConstraints.EAST;
		gbc_lblBlendcost.insets = new Insets(0, 0, 5, 5);
		gbc_lblBlendcost.gridx = 1;
		gbc_lblBlendcost.gridy = 8;
		add(lblBlendcost, gbc_lblBlendcost);

		blendCost_textField = new JTextField();
		GridBagConstraints gbc_blendCost_textField = new GridBagConstraints();
		gbc_blendCost_textField.insets = new Insets(0, 0, 5, 5);
		gbc_blendCost_textField.fill = GridBagConstraints.HORIZONTAL;
		gbc_blendCost_textField.gridx = 2;
		gbc_blendCost_textField.gridy = 8;
		add(blendCost_textField, gbc_blendCost_textField);
		blendCost_textField.setColumns(10);

		JLabel lblComments = new JLabel("Comments");
		GridBagConstraints gbc_lblComments = new GridBagConstraints();
		gbc_lblComments.anchor = GridBagConstraints.EAST;
		gbc_lblComments.insets = new Insets(0, 0, 5, 5);
		gbc_lblComments.gridx = 1;
		gbc_lblComments.gridy = 9;
		add(lblComments, gbc_lblComments);

		Comments_textPane = new JTextPane();
		GridBagConstraints gbc_Comments_textPane = new GridBagConstraints();
		gbc_Comments_textPane.insets = new Insets(0, 0, 5, 5);
		gbc_Comments_textPane.fill = GridBagConstraints.BOTH;
		gbc_Comments_textPane.gridx = 2;
		gbc_Comments_textPane.gridy = 9;
		add(Comments_textPane, gbc_Comments_textPane);

		JButton btnUpdate = new JButton("Update");
		GridBagConstraints gbc_btnUpdate = new GridBagConstraints();
		gbc_btnUpdate.insets = new Insets(0, 0, 0, 5);
		gbc_btnUpdate.gridx = 4;
		gbc_btnUpdate.gridy = 10;
		add(btnUpdate, gbc_btnUpdate);

	}

	public void setFields(String the_id,String the_smell,String the_color,String the_type,String the_name,
			String the_date,
			String the_comments){

		colorTest_comboBox.setSelectedIndex(Integer.parseInt(the_color)-1);
		smellTest_comboBox.setSelectedIndex(Integer.parseInt(the_smell)-1);
		blendID_textField.setText(the_id);
		blendType_textField.setText(the_type);
		blendName_textField.setText(the_name);
		blendDate_textField.setText(the_date);
		blendCost_textField.setText("Need to query");
		Comments_textPane.setText(the_comments);

	}

}
